package first;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;


/**
 * @author
 * @since 2017/7/6 下午7:20
 * Purpose
 */
public class HelloWorld {
    public static void hello(String... names) {
        /**
         * Flowable是2.x版本新增的
         */
        Flowable.fromArray(names).subscribe(new Consumer<String>() {
            @Override
            public void accept(String s) throws Exception {
                System.out.println(s);
            }
        });
        /**
         * Observable是旧版本的
         */
        Observable.fromArray(names).blockingSubscribe(new Consumer<String>() {
            @Override
            public void accept(String s) throws Exception {
                System.out.println(s);
            }
        });
    }

    public static void main(String[] args) {
        hello("Hello World!");
    }
}
